// 颜色变量
:root {
  // 主色调
  --primary-color: #409eff;
  --primary-light-1: #53a8ff;
  --primary-light-2: #66b1ff;
  --primary-light-3: #79bbff;
  --primary-light-4: #8cc5ff;
  --primary-light-5: #a0cfff;
  --primary-light-6: #b3d8ff;
  --primary-light-7: #c6e2ff;
  --primary-light-8: #d9ecff;
  --primary-light-9: #ecf5ff;
  --primary-dark-1: #337ecc;
  --primary-dark-2: #2d70b3;
  
  // 成功色
  --success-color: #67c23a;
  --success-light: #95d475;
  --success-lighter: #b3e19d;
  --success-extra-light: #f0f9ff;
  
  // 警告色
  --warning-color: #e6a23c;
  --warning-light: #ebb563;
  --warning-lighter: #f0c78a;
  --warning-extra-light: #fdf6ec;
  
  // 危险色
  --danger-color: #f56c6c;
  --danger-light: #f78989;
  --danger-lighter: #fab6b6;
  --danger-extra-light: #fef0f0;
  
  // 信息色
  --info-color: #909399;
  --info-light: #a6a9ad;
  --info-lighter: #c8c9cc;
  --info-extra-light: #f4f4f5;
  
  // 文本颜色
  --text-color-primary: #303133;
  --text-color-regular: #606266;
  --text-color-secondary: #909399;
  --text-color-placeholder: #a8abb2;
  --text-color-disabled: #c0c4cc;
  
  // 边框颜色
  --border-color-base: #dcdfe6;
  --border-color-light: #e4e7ed;
  --border-color-lighter: #ebeef5;
  --border-color-extra-light: #f2f6fc;
  
  // 背景色
  --bg-color: #ffffff;
  --bg-color-page: #f2f3f5;
  --bg-color-overlay: #ffffff;
  
  // 填充色
  --fill-color-darker: #e6e8eb;
  --fill-color-dark: #ebedf0;
  --fill-color-base: #f0f2f5;
  --fill-color-light: #f5f7fa;
  --fill-color-lighter: #fafafa;
  --fill-color-extra-light: #fafcff;
  --fill-color-blank: #ffffff;
  
  // 阴影
  --box-shadow-base: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.04);
  --box-shadow-dark: 0 2px 4px rgba(0, 0, 0, 0.12), 0 0 6px rgba(0, 0, 0, 0.12);
  --box-shadow-light: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  
  // 字体
  --font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
  --font-size-extra-large: 20px;
  --font-size-large: 18px;
  --font-size-medium: 16px;
  --font-size-base: 14px;
  --font-size-small: 13px;
  --font-size-extra-small: 12px;
  
  // 字重
  --font-weight-primary: 500;
  --font-weight-secondary: 400;
  
  // 行高
  --line-height-primary: 24px;
  --line-height-base: 1.5;
  
  // 间距
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 12px;
  --spacing-lg: 16px;
  --spacing-xl: 20px;
  --spacing-xxl: 24px;
  --spacing-xxxl: 32px;
  
  // 圆角
  --border-radius-base: 4px;
  --border-radius-small: 2px;
  --border-radius-round: 20px;
  --border-radius-circle: 100%;
  
  // 过渡
  --transition-duration: 0.3s;
  --transition-function-ease-in-out-bezier: cubic-bezier(0.645, 0.045, 0.355, 1);
  --transition-function-fast-bezier: cubic-bezier(0.23, 1, 0.32, 1);
  --transition-all: all var(--transition-duration) var(--transition-function-ease-in-out-bezier);
  --transition-fade: opacity var(--transition-duration) var(--transition-function-fast-bezier);
  --transition-md-fade: transform var(--transition-duration) var(--transition-function-fast-bezier), opacity var(--transition-duration) var(--transition-function-fast-bezier);
  --transition-border: border-color var(--transition-duration) var(--transition-function-ease-in-out-bezier);
  --transition-box-shadow: box-shadow var(--transition-duration) var(--transition-function-ease-in-out-bezier);
  --transition-color: color var(--transition-duration) var(--transition-function-ease-in-out-bezier);
  
  // Z-index
  --z-index-normal: 1;
  --z-index-top: 1000;
  --z-index-popper: 2000;
  --z-index-dialog: 3000;
  --z-index-message: 4000;
  --z-index-loading: 5000;
}

// 暗色主题
[data-theme='dark'] {
  --primary-color: #409eff;
  --primary-light-1: #53a8ff;
  --primary-light-2: #66b1ff;
  --primary-light-3: #79bbff;
  --primary-light-4: #8cc5ff;
  --primary-light-5: #a0cfff;
  --primary-light-6: #b3d8ff;
  --primary-light-7: #c6e2ff;
  --primary-light-8: #d9ecff;
  --primary-light-9: #ecf5ff;
  
  --text-color-primary: #e5eaf3;
  --text-color-regular: #cfd3dc;
  --text-color-secondary: #a3a6ad;
  --text-color-placeholder: #8d9095;
  --text-color-disabled: #6c6e72;
  
  --border-color-base: #4c4d4f;
  --border-color-light: #414243;
  --border-color-lighter: #363637;
  --border-color-extra-light: #2b2b2c;
  
  --bg-color: #141414;
  --bg-color-page: #0a0a0a;
  --bg-color-overlay: #1d1e1f;
  
  --fill-color-darker: #424243;
  --fill-color-dark: #39393a;
  --fill-color-base: #303030;
  --fill-color-light: #262727;
  --fill-color-lighter: #1d1d1d;
  --fill-color-extra-light: #191919;
  --fill-color-blank: #141414;
}

// 断点系统
$breakpoints: (
  xs: 0,
  sm: 576px,
  md: 768px,
  lg: 992px,
  xl: 1200px,
  xxl: 1400px
);

// 媒体查询混入
@mixin respond-to($breakpoint) {
  @if map-has-key($breakpoints, $breakpoint) {
    @media (min-width: map-get($breakpoints, $breakpoint)) {
      @content;
    }
  } @else {
    @warn "Unknown breakpoint: #{$breakpoint}.";
  }
}

@mixin respond-below($breakpoint) {
  @if map-has-key($breakpoints, $breakpoint) {
    @media (max-width: map-get($breakpoints, $breakpoint) - 1px) {
      @content;
    }
  } @else {
    @warn "Unknown breakpoint: #{$breakpoint}.";
  }
}
}

// 工具类混入
@mixin flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

@mixin flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@mixin flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

@mixin flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

@mixin text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@mixin text-ellipsis-multi($lines: 2) {
  display: -webkit-box;
  -webkit-line-clamp: $lines;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

@mixin clearfix {
  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

@mixin hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  
  &:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
}

@mixin card-shadow {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius-base);
  background: var(--bg-color);
  border: 1px solid var(--border-color-lighter);
}

// 动画混入
@mixin fade-in($duration: 0.3s) {
  animation: fadeIn $duration ease-in-out;
}

@mixin slide-in-up($duration: 0.3s) {
  animation: slideInUp $duration ease-out;
}

@mixin slide-in-down($duration: 0.3s) {
  animation: slideInDown $duration ease-out;
}

@mixin bounce-in($duration: 0.6s) {
  animation: bounceIn $duration ease-out;
}

// 关键帧动画
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-10px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(10px);
  }
}

// 滚动条样式
@mixin custom-scrollbar($width: 6px, $track-color: transparent, $thumb-color: rgba(0, 0, 0, 0.3)) {
  &::-webkit-scrollbar {
    width: $width;
    height: $width;
  }
  
  &::-webkit-scrollbar-track {
    background: $track-color;
    border-radius: calc($width / 2);
  }
  
  &::-webkit-scrollbar-thumb {
    background: $thumb-color;
    border-radius: calc($width / 2);
    
    &:hover {
      background: rgba(0, 0, 0, 0.5);
    }
  }
}

// 加载动画
@mixin loading-spinner($size: 20px, $color: var(--primary-color)) {
  width: $size;
  height: $size;
  border: 2px solid rgba(64, 158, 255, 0.3);
  border-top: 2px solid #409eff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}